﻿#include "CentralWidget.h"
#include "ui_CentralWidget.h"
#include "GUIWidget/ControlPanel.h" 
#include "GUIWidget/GraphArea.h"
#include "FITK_Component/FITKWidget/FITKMdiArea.h"
#include <QSplitter>

namespace GUI
{
    CentralWidget::CentralWidget(QWidget * parent):QWidget(parent)
    {
        //创建对象
        _ui = new Ui::CentralWidget;
        _ui->setupUi(this);
     
        // 子部件水平排布
        QSplitter *spliterLayout = new QSplitter(Qt::Horizontal, this);
        spliterLayout->setMouseTracking(true);
        spliterLayout->setHandleWidth(5);

        _controlPanel = new ControlPanel(this);
        _graphArea = new GraphArea(this);
 
        //添加树界面
        spliterLayout->addWidget(_controlPanel);
        //添加属性界面
        spliterLayout->addWidget(_graphArea);
        // 设置大小
        spliterLayout->setSizes({ 2000, 8000 });
        _ui->layout->addWidget(spliterLayout);
    }

    CentralWidget::~CentralWidget()
    {
        if (_controlPanel) delete _controlPanel;
        if (_graphArea) delete _graphArea;
        if (_ui) delete _ui;
    }
 
    GUI::ControlPanel* CentralWidget::getControlPanel()
    {
        return _controlPanel;
    }

    GUI::GraphArea* CentralWidget::getGraphArea()
    {
        return _graphArea;
    }

    

}

